<!-- $Id: brand_info.htm 14216 2008-03-10 02:27:21Z testyang $ -->
{include file="pageheader.htm"}
<div class="main-div">
    <form method="post" action="comparison_goods.php" name="theForm" enctype="multipart/form-data" onsubmit="return validate()">
        <table cellspacing="1" cellpadding="3" width="100%">
            <tr>
                <td class="label">对比商品名称：</td>
                <td><input type="text" name="goods_name" maxlength="60" value="{$goods.goods_name}" />{$lang.require_field}</td>
            </tr>
            <tr>
                <td class="label">所属品牌：</td>
                <td>
                    {if $brand neq null}
                    <select name="brand_id"  onchange="hideBrandDiv()" >
                        {foreach from=$brand item=val}
                        <option value="{$val.brand_id}" {if $goods.brand_id eq $val.brand_id}checked{/if}>{$val.brand_name}</option>
                        {/foreach}
                    </select>
                    {else}
                    请先添加对比品牌！
                    {/if}
                    <a href="javascript:void(0)" title="添加品牌" onclick="rapidBrandAdd()" class="special" >添加品牌</a>
                  <span id="brand_add" style="display:none;">
                    <input class="text" size="15" name="addedBrandName" />
                   <a href="javascript:void(0)" onclick="addBrand()" class="special" >确定</a>

                   <a href="javascript:void(0)" onclick="hideBrandDiv()" title="隐藏" class="special" ><<</a>
                   </span>
                </td>
            </tr>
            <tr>
                <td class="label"><a href="javascript:showNotice('warn_brandlogo');" title="{$lang.form_notice}">
                    <img src="images/notice.gif" width="16" height="16" border="0" alt="{$lang.form_notice}"></a>对比商品LOGO：</td>
                <td><input type="file" name="goods_img" id="logo" size="45">{if $goods.goods_img neq ""}<input type="button" value="删除图标" onclick="if (confirm('你确认要删除该图标吗？'))location.href='comparison_goods.php?act=drop_logo&id={$goods.goods_id}'">{/if}
                    <br /><span class="notice-span" {if $help_open}style="display:block" {else} style="display:none" {/if} id="warn_brandlogo">
                    {if $goods.goods_img eq ''}
                    请上传图片，做为商品的LOGO！
                    {else}
                    你已经上传过图片。再次上传时将覆盖原图片！
                    {/if}
                    </span>
                </td>
            </tr>

            <tr>
                <td colspan="2" align="center"><br />
                    <input type="submit" class="button" value="{$lang.button_submit}" />
                    <input type="reset" class="button" value="{$lang.button_reset}" />
                    <input type="hidden" name="act" value="{$form_action}" />
                    <input type="hidden" name="old_goodsname" value="{$goods.goods_name}" />
                    <input type="hidden" name="id" value="{$goods.goods_id}" />
                    <input type="hidden" name="old_goodsimg" value="{$goods.goods_img}">
                </td>
            </tr>
        </table>
    </form>
</div>
{insert_scripts files="../js/utils.js,validator.js"}
{literal}
<script language="JavaScript">
    <!--
    document.forms['theForm'].elements['goods_name'].focus();
    onload = function()
    {
        // 开始检查订单
        startCheckOrder();
    }
    /**
     * 检查表单输入的数据
     */
    function validate()
    {
        validator = new Validator("theForm");
        validator.required("goods_name",  '您必须输入品牌名称！');
        return validator.passed();
    }

    function hideBrandDiv()
    {
        var brand_add_div = document.getElementById("brand_add");
        if(brand_add_div.style.display != 'none')
        {
            brand_add_div.style.display = 'none';
        }
    }

    function rapidBrandAdd(conObj)
    {
        var brand_div = document.getElementById("brand_add");

        if(brand_div.style.display != '')
        {
            var brand =document.forms['theForm'].elements['addedBrandName'];
            brand.value = '';
            brand_div.style.display = '';
        }
    }

    function addBrand()
    {
        var brand = document.forms['theForm'].elements['addedBrandName'];
        if(brand.value.replace(/^\s+|\s+$/g, '') == '')
        {
            alert(brand_cat_not_null);
            return;
        }

        var params = 'brand=' + brand.value;
        Ajax.call('comparison_brand.php?is_ajax=1&act=add_brand', params, addBrandResponse, 'GET', 'JSON');
    }

    function addBrandResponse(result)
    {
        if (result.error == '1' && result.message != '')
        {
            alert(result.message);
            return;
        }

        var brand_div = document.getElementById("brand_add");
        brand_div.style.display = 'none';

        var response = result.content;

        var selCat = document.forms['theForm'].elements['brand_id'];
        var opt = document.createElement("OPTION");
        opt.value = response.id;
        opt.selected = true;
        opt.text = response.brand;

        if (Browser.isIE)
        {
            selCat.add(opt);
        }
        else
        {
            selCat.appendChild(opt);
        }

        return;
    }

    //-->
</script>
{/literal}
{include file="pagefooter.htm"}